﻿@using CodeGenerator.Common
@using CodeGenerator.Core
@using System.Text
@{
    MybatisCodeCreate model = Model;
    string entityName = Utils.Pascal(model.Name);
    string whereStr = "";
    for (int i = 1; i <= model.TableInfo.PrimaryKeyColumns.Count; i++)
    {
        ColumnInfo column = model.TableInfo.PrimaryKeyColumns[i - 1];

        if (i != model.TableInfo.PrimaryKeyColumns.Count)
        {
            whereStr +=  "@Param(\""+column.Name+"\")"+ column.JavaType.Alias + "  "+column.Name+" , ";
           
        }
        else
        {
            whereStr += column.JavaType.Alias + " " + column.Name + "";
            whereStr += "@Param(\"" + column.Name + "\")" + column.JavaType.Alias + "  " + column.Name;
        }
    }
}
package @(model.IServicePackage);

import @(model.EntityPackage);

import java.util.List;
import org.apache.ibatis.annotations.Param;

public interface @(entityName)Service {
    int deleteByPrimaryKey(@whereStr);

    int insert(@(entityName) record);

    int insertSelective(@(entityName) record);

    @(entityName) selectByPrimary(@whereStr);

    int updateByPrimaryKeySelective(@(entityName) record);

    int updateByPrimaryKey(@(entityName) record);

    List<@(entityName)> selectList(@(entityName) record);
}
